home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 002 / wscon.arc / WSCONV.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1985-06-20  |  1.2 KB  |  54 lines

  1.  
  2.  
  3.    program convert(input,output);
  4.  
  5.  
  6.        type wstype = char;
  7.  
  8.  
  9.     var infile     : file of wstype;
  10.         outfile    : text;
  11.         in1        : char;
  12.  
  13.      label stop_here, start_again;
  14.  
  15. {$I arglist.pas}
  16.  
  17.  
  18.  
  19.     begin
  20.        if argc <2 then
  21.        begin
  22.           writeln('Wordstar file conversion');
  23.           writeln('WSCONV wsfile.ext textfile.ext');
  24.           writeln('Press any key...');
  25.           repeat until keypressed;
  26.           goto stop_here;
  27.        end;
  28.        writeln('working');
  29.        assign(infile,argv(1));
  30.        assign(outfile,argv(2));
  31.        reset(infile);
  32.        rewrite(outfile);
  33.        while not eof(infile) do
  34.        begin
  35.           read(infile,in1);
  36.           while in1 = chr(27) do
  37.           begin
  38.              read(infile,in1);
  39.              read(infile,in1);
  40.           end;
  41.           if ord(in1) > 128 then
  42.              in1 := chr(ord(in1)-128);
  43.           if in1 in [chr(0)..chr(11),chr(12),chr(14)..chr(26)] then
  44.              goto start_again;
  45.           if (in1 in [chr(11),chr(13)]) then
  46.              writeln(outfile,'')
  47.           else
  48.              write(outfile,in1);
  49.           start_again:
  50.        end;
  51.        close(infile);
  52.        close(outfile);
  53.        stop_here:
  54.     end.